<?php

namespace app\index\controller;

use app\common\arvato\CommonPush;
use app\common\common\Helper;
use app\index\service\ServiceService;

/**
 * Description of Service
 *
 * @author tommy.pan
 */
class Service extends \app\common\controller\AuthBase {

    /**
     * 通过队列将预约推送到arvato
     */
    public function pushToRedis() {

        $params = $this->input();
        //过滤所需参数是存在
        $arvatoCommonPush = new CommonPush();
        $res = $arvatoCommonPush->pushToRedis($params['data'], $params['funcName']);
        if ($res) {
            Helper::output([]);
        }
        Helper::output([], 'failToSetRedis');
    }

    /**
     * 建立通过patientId重试的方法
     * @return type
     */
    public function retrieveWamDataByPatientId() {
        $params = $this->input();
        $param_list = [
            'service_order_id' => 'string', //集团标识
        ];
        $this->diffParam($param_list, $params);
        $serviceService = new ServiceService();
        $saveDataToDb = $serviceService->saveDataToDb($params);
        if ($saveDataToDb) {
            return Helper::output([]);
        }
        return Helper::output([], 'error');
    }

}
